# -*- encoding:utf-8 -*-
# @Time: 2022/11/6 22:25
# @Author :xibin
# @Email: xibin@maqu. com
# @File: urls.py
# @Software: PyCharm
from .views import StudentViewset,ClassesViewset  #导入视图集
from django.urls import path
from rest_framework.routers import DefaultRouter,SimpleRouter  #DefaultRouter优化路由需要用的

#复杂的就用这个，最好配套使用
# urlpatterns = [
#     path('student/',StudentViewset.as_view({'get':'list','post':'create'})),
#     path('student/<pk>',StudentViewset.as_view({'get':'retrieve','put':'update','delete':'destroy'}))
# ]

#标准增删改查可以用，这也是优化路由
urlpatterns =[

]
router = DefaultRouter() #创建路由器
router.register('class',ClassesViewset)  #注册路由器，前面的’student‘表示网页要访问的路由，可以写成’aaa‘，这样访问的时候网址就要写127...aaa/1
urlpatterns += router.urls  #拼接路由，拼到上面去